package persistence;

final public class Purchaser {
	private int id=0;
	private String firstName;
	private String lastName;
	private LibraryLocation libraryLocation;
	
	protected Purchaser() {}
	
	protected Purchaser(int id, String firstName, String lastName, LibraryLocation libraryLocation) {
		setId(id);
		setFirstName(firstName);
		setLastName(lastName);
		setLibraryLocation(libraryLocation);
	}	

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + id;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Purchaser other = (Purchaser) obj;
		if (id != other.id)
			return false;
		return true;
	}
	
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Purchaser: id=").append(id).append(", firstName=").append(firstName).
		append(", lastName=").append(lastName).append(", libraryLocation=").append(libraryLocation);
		
		return builder.toString();
		
	}

	public int getId() {
		return id;
	}

	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public LibraryLocation getLibraryLocation() {
		return libraryLocation;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setLibraryLocation(LibraryLocation libraryLocation) {
		this.libraryLocation = libraryLocation;
	}
}
